package Thread;

public class ThreadDemo01  {
    public static void main(String[] args) {
        MyThread1 r1 = new MyThread1();
        MyThread2 r2 = new MyThread2();
        Thread t1 = new Thread(r1);
        Thread t2 = new Thread(r2);
        t1.start();
        t2.start();
    }

}
//class MyThread1 extends Thread{
//    @Override
//    public void run() {
//        for (int i = 0; i < 1000; i++) {
//            System.out.println("有本事你开门啊");
//        }
//    }
//}
//class MyThread2 extends Thread{
//    @Override
//    public void run() {
//        for (int i = 0; i < 1000; i++) {
//            System.out.println("就不开");
//        }
//    }
//}
class MyThread1 implements  Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {

            System.out.println("就不开");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
class MyThread2 implements  Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("有本事你开门啊");
            try {
                Thread.sleep(1500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}